/**
 * User: alesj
 * Date: 2004.8.11
 * Time: 15:09:32
 */

package com.generalynx.ecos.data;

import java.io.Serializable;

import com.generalynx.common.utils.Tools;
import com.generalynx.common.utils.EmptyValueFormat;

public class Person implements Serializable {

    private static final long serialVersionUID = 1L;

    private String m_name;
    private String m_surname;
    private String m_telephone;
    private String m_email;

    public String toString() {
        return toString(false);
    }

    public String toString(boolean surnameFirst) {
        Object[] array;
        if (surnameFirst) {
            array = new Object[]{getSurname(), getName()};
        } else {
            array = new Object[]{getName(), getSurname()};
        }
        return Tools.implode(array, " ", false, null, null, EmptyValueFormat.INSTANCE).trim();
    }

    public String value(String value) {
        return value != null ? value : "";
    }

    /**
     * @hibernate.property
     */
    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        m_name = name;
    }

    /**
     * @hibernate.property
     */
    public String getSurname() {
        return m_surname;
    }

    public void setSurname(String surname) {
        m_surname = surname;
    }

    /**
     * @hibernate.property column="phone"
     */
    public String getTelephone() {
        return m_telephone;
    }

    public void setTelephone(String telephone) {
        m_telephone = telephone;
    }

    /**
     * @hibernate.property
     */
    public String getEmail() {
        return m_email;
    }

    public void setEmail(String email) {
        m_email = email;
    }

}
